<template>
    <div class="login-form">
       
        <tr>
            <td>导演能力值</td>
            <td> <input type="text" v-model="director"></td>
        </tr>
        <tr>
            <td>演员能力值</td>
            <td> <input type="text" v-model="actor"></td>
        </tr>
        <tr>
            <td>编剧能力值  </td>
            <td> <input type="text" v-model="enditor"></td>
        </tr>
        <tr>
            <td> <button type="submit" value="Submit" @click="query">提交</button></td>
            <td> <button type="reset" value="Reset">取消</button></td>
        </tr>

        <div class="result">
            <tr>
                <td>评分预测模型准确率:</td>
                <td>
                    <p>{{dataList.scoreaccuracy}}</p>
                </td>
            </tr>
            <tr>
                <td>电影评分预测:</td>
                <td>    
                    <p>{{dataList.scorepredicts}} </p>
                </td>
            </tr>
            <tr>
                <td>票房预测模型准确率:</td>
                <td>
                    <p>{{dataList.fficeaccuracy}}</p>
                </td>
            </tr>
            <tr>
                <td>电影票房预测:</td>
                <td>
                    <p>{{dataList.boxoffice }} </p>
                </td>
            </tr>

            <tr>
                <td> <button type="submit" value="Submit" @click="getresult">获取预测结果</button></td>
            </tr>
        </div>
    </div>

</template>

<script>
    import {querysave,result} from "@/api/film";
    export default {
        name: "predict",
        data() {
            return {
                directorcapacity: '',
                starring: '',
                screen: '',
                director: '',
                actor: "",
                enditor: '',
                dataList:"",
            };
        },
        methods: {
            query() {
                let data = {
                    directorcapacity: this.directorcapacity,
                    starring: this.starring,
                    screen: this.screen,
                    director: this.director,
                    actor: this.actor,
                    enditor: this.enditor
                };
                console.log(data);
                querysave(data).then(res => {})
            },
            getresult(){
                // console.log("1345678");
                result().then(res=>{
                  this.dataList=res.data[0];
                  console.log(this.dataList);
               })
            }
        }
    }
</script>

<style>
    .login-form {
        margin-top: 100px;
        margin-left: 450px;
    }

    .result {
        position: relative;
        top: -200px;
        left: 500px;
    }
    p{
        margin-left: 200px;
    }
    tr{
        line-height: 50px;
    }
</style>